import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientDemo001 {
	public static void main(String[] args) {
		try {
			Socket socket = new Socket("127.0.0.1",9999);
			
			OutputStream out = socket.getOutputStream();
			out.write("hello,I am client--\n".getBytes());
			InputStream in = socket.getInputStream();
			
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String str  = br.readLine();
			System.out.println(str);
			br.close();
			in.close();
			out.close();
			socket.close();
			
			
		
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
